class Plan implements Comparable {
    static mapping = {
      table 'yuying_plan'
      sort 'lastUpdated'
      description type:"text"
      content type:"text"
    }
  public static Integer PLAN_TYPE_SHOULD_DO = new Integer(0)
  public static Integer PLAN_TYPE_SHOULD_CARE = new Integer(1)

  String name
  String description
  String content
  Integer startWith
  Integer endWith
  Integer planType
  Integer displayPosition
  Boolean published
  String scheme
  Date dateCreated
  Date lastUpdated

  static constraints = {
    description(nullable:true)
    planType(nullable:true)
    scheme(nullable:true)
    content(nullable:true)
    displayPosition(nullable:true)
  }

  public int compareTo(Object o) {
    Plan obj = (Plan) o;
    if (this.displayPosition == null || this.displayPosition.equals(obj.displayPosition)) {
      return this.startWith.compareTo(obj.startWith);
    }
    return displayPosition.compareTo(obj.displayPosition);
  }  
}
